package com.bibrApp.difu.actvity.others;

import android.graphics.Color;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bibrApp.difu.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

public class TabAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    int select = 0;

    public TabAdapter() {
        super(R.layout.item_tab, new ArrayList<>());
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, String item) {
        helper.setText(R.id.item_text, item);
        helper.setTextColor(R.id.item_text, getData().indexOf(item) == select ? Color.parseColor("#1D89E4") : Color.parseColor("#333333"));
        helper.setVisible(R.id.item_tab, getData().indexOf(item) == select);

    }

    public void setSelect(int select) {
        this.select = select;
        notifyDataSetChanged();
    }
}
